package com.czk.gulimall.search.controller;

import com.czk.common.to.es.SkuEsModel;
import com.czk.common.utils.R;
import com.czk.gulimall.search.service.ProductSaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/12/24 15:26
 */
@RestController
@RequestMapping("/search")
public class ElasticSaveController {
    @Autowired
    private ProductSaveService productSaveService;

    @PostMapping("/product")
    public R productStatusUp(@RequestBody List<SkuEsModel> skuEsModels) {
        boolean b = productSaveService.productStatusUp(skuEsModels);
        if (b) {
            return R.ok("商品上架成功");
        }
        return R.error("商品上架错误");
    }
}
